package com.wdd.atcrowdfunding.manager.service.impl;

import com.wdd.atcrowdfunding.bean.Tag;
import com.wdd.atcrowdfunding.manager.dao.TagMapper;
import com.wdd.atcrowdfunding.manager.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TagServiceImpl implements TagService {

    @Autowired
    private TagMapper tagMapper;

    @Override
    public List<Tag> selectAll() {
        return tagMapper.selectByExample(null);
    }

    @Override
    public Tag getTagById(Integer id) {
        return tagMapper.selectByPrimaryKey(id);
    }

    @Override
    public int saveTag(Tag tag) {
        return tagMapper.insert(tag);
    }

    @Override
    public int deleteTag(Integer id) {
        return tagMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int updateTag(Tag tag) {
        return tagMapper.updateByPrimaryKey(tag);
    }
}
